<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>公告栏</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="<%= basePath %>assets/css/dpl-min.css" rel="stylesheet" type="text/css" />
    <link href="<%= basePath %>assets/css/bui-min.css" rel="stylesheet" type="text/css" />
    <link href="<%= basePath %>assets/css/page-min.css" rel="stylesheet" type="text/css" />
    
     <script src="http://g.tbcdn.cn/fi/bui/jquery-1.8.1.min.js"></script>
	  <script src="http://g.alicdn.com/bui/seajs/2.3.0/sea.js"></script>
	  <script src="http://g.alicdn.com/bui/bui/1.1.21/config.js"></script>
	  <link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/dpl.css" rel="stylesheet">
  	  <link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/bui.css" rel="stylesheet">
      
    <style type="text/css">
   		body{
   			text-align:center;
   			padding: 20px 50px 20px 30px;
   		}
    	.doc-content{
    		width:100%;
    		height:150px;
    	}
    	
    	.doc-content .panel-header{
    		height:30px;
    		letter-spacing:5px;
    		background:#DFF0D8;
    	}
    	.doc-content .panel-body{
    	
    		height:120px;
    	}
    	.doc-content .panel-body #demo,.doc-content .panel-body #demo1,.doc-content .panel-body #demo2{
    		height:120px;
    		padding-left:150px;
    	}
    	.span24{
    		width:98%;
    		margin-top:70px;
    	}
    	.notice{
    		width:100%;
    		text-align:left;
    	}
    	
    	.table-bordered td ,.table-bordered th{
    		text-align:center;
    	}
    	.table-bordered th{
    		background:#DFF0D8;
    	}
    	.oneSpan{
    		display:inline-block;
    		margin:0 10px;
    		width:50px;
    	}
    	.well {
			background: #DFF0D8;
			display:inline-block;
		}
   </style>
   
    
</head>
<body>
	<s:property value="tip"/>
	<div class="doc-content">
	    <div class="panel ">
	      <div class="panel-header">
	        <h1>最近一周公告</h1>
	        
	      </div>
	      
	      <div class="panel-body">
	      		<table class="notice">
	      			<tr>
	      				<td>
	      					<div id="demo" style="overflow:hidden;height:100px;border:1px solid #dde5bc;">
					          <div id="demo1"> 
							       <s:iterator value="topAnnos" var="one">
							         	 <a href="#">
								            <div>
								            	<font style="font-weight:bold;">
								            	&gt;&gt;&gt;
								            		<span class="oneSpan">
								            			<s:property value="#one.deptid"/>
								            		</span>
								            	</font>&nbsp;&nbsp;&nbsp;&nbsp;
								            	<s:date name="#one.annotime" format="yyyy-MM-dd HH:mm:ss"/>
								            	  &nbsp;&nbsp;发表公告：&nbsp;&nbsp;
								            	<s:property value="#one.annocontent"/>
								            </div>
						           		 </a>
						          </s:iterator>
					          </div>
					          
					          <div id="demo2"></div>
					        </div>
					        <script>
								var speed=50
								var demo=document.getElementById("demo");
								var demo2=document.getElementById("demo2");
								var demo1=document.getElementById("demo1");
								demo2.innerHTML=demo1.innerHTML
								function Marquee(){
								if(demo2.offsetTop-demo.scrollTop<=0)
								demo.scrollTop-=demo1.offsetHeight
								else{
								demo.scrollTop++
								}
								}
								var MyMar=setInterval(Marquee,speed)
								demo.onmouseover=function() {clearInterval(MyMar)}
								demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
							</script>
	      				</td>
	      			</tr>
	      		</table>
	      </div>
	    </div>
	 </div>  
	  
	  <div class="span24" ">
       	<s:property value="tip"/>
       	<table cellspacing="0" class="table table-bordered">
          <thead>
           
            <tr>
              <th>公告发布部门</th>
              <th>公告内容</th>
              <th>发布时间</th>
              <s:if test="#session.userInfo.baseGroupType == 1">
              	<th>操作</th>
              </s:if>
            </tr>
          </thead>
          <tbody>
          <!-- 迭代输出数据 -->
			<s:iterator value="pageInfo.basePageList" var="one">
			<tr>
				<td><s:property value="#one.deptid"/></td>
				<td> <s:property value="#one.annocontent"/></td>
				<td><s:date name="#one.annotime" format="yyyy-MM-dd HH:mm:ss"/></td>
				<s:if test="#session.userInfo.baseGroupType == 1">
					<td>
						<a href="<%=basePath%>anno/delete?anno.annoid=<s:property value="#one.annoid"/>" 
		              		class="delete button" style="border:0px;"  >
		              			<i class="icon-black icon-trash"></i>
		              	</a>
					</td>
				</s:if>
			</tr>
			</s:iterator>
          </tbody>
         </table>
       	<!-- 模糊查询表单 -->
		<div class="pagination pull-left">
			<form class="" action="<%=basePath%>anno/show">
				<input type="text" class="control-text span-width"
					placeholder="输入关键字…" name="keyword"
					value="<s:property value="keyword"/>"> 
				<input type="submit" class="button button-info" 
					value="查询" style="margin-left: 30px;">
			</form>
		</div>
          
          <div class="pagination pull-right" style="margin-top:30px;">
            <ul>
					<!-- 显示总记录数和总页数 -->
					<li class="disabled" style="letter-spacing:2px;">
						<a href="">
							总共<s:property value="pageInfo.rootListSize"/>条/<s:property value="pageInfo.pageCount"/>页
						</a>
					</li>

					<!-- 是否要上一页按钮 -->
					<s:if test="pageInfo.nowPage>1">
						<li class="active">
							<a href="<%= basePath %>anno/show?targetPage=<s:property value="pageInfo.nowPage - 1"/>">« 上一页</a>
						</li>
					</s:if>
					<s:else>
						<li class="disable">
							<a href="#">« 上一页</a>
						</li>
					</s:else>
					
					<!-- 迭代输出每一页的页号 -->
					<s:iterator value="pageInfo.pageNoList" var="page">
						<!-- 首先确保不是-1 -->
						<s:if test="#page != -1">
							<s:if test="#page != 0">
								<!-- 如果是当前页，特殊颜色显示 -->
								<s:if test="#page == pageInfo.nowPage">
									<li class="active">
										<a href="<%= basePath %>anno/show?keyword=<s:property value="keyword"/>&targetPage=<s:property value="#page"/>">
											<s:property value="#page"/>
										</a>
									</li>
								</s:if>
								
								<!-- 否则一般颜色显示 -->
								<s:else>
									<li>
										<a href="<%= basePath %>anno/show?keyword=<s:property value="keyword"/>&targetPage=<s:property value="#page"/>">
											<s:property value="#page"/>
										</a>
									</li>
								</s:else>
							</s:if>
							<s:else>
								<li>
									<a href="<%= basePath %>anno/show?keyword=<s:property value="keyword"/>&targetPage=1">...</a>
								</li>
							</s:else>
						</s:if>
					</s:iterator>
					
					<!-- 是否需要最后一页的按钮 -->
					<s:if test="pageInfo.pageCount == pageInfo.nowPage">
						<li class="disable">
							<a href="#">下一页 »</a>
						</li>
					</s:if>
					<s:else>
						<li class="active">
							<a href="<%= basePath %>anno/show?keyword=<s:property value="keyword"/>&targetPage=<s:property value="pageInfo.nowPage + 1"/>">下一页 »</a>
						</li>
					</s:else>
				</ul>
          </div>
        </div>
      </div>
	  
	  
	   <script type="text/javascript">
	   var href="";
        BUI.use('bui/overlay',function(Overlay){
          var dialog = new Overlay.Dialog({
            title:'确认框 ',
            width:300,
            height:200,
            bodyContent:'<p>是否确认删除  ？ </p>',
            success:function () {
            	console.log(href);
            	window.location.href=href;
            }
          });
        
        $('.delete').on('click',function (e) {
        	e.preventDefault();//a标签禁用
        	href=this.href;
          	dialog.show();
        });
    });
  </script>
	  
</body>
</html>